//
//  JXMeTabViewController.m
//  JXAddressApp
//
//  Created by zhhw_home on 2018/10/28.
//  Copyright © 2018年 zhhw_home. All rights reserved.
//

#import "JXMeTabViewController.h"
#import "QMUIButton.h"
#import "QMUICommonDefines.h"
#import "UIColor+QMUI.h"
#import "UILabel+QMUI.h"
#import "Masonry.h"
#import "QMUINavigationController.h"
#import "JXBaseWKWebViewController.h"

@interface JXMeTabViewController ()

@property (nonatomic, strong) UILabel       *titleLabel;

@property (nonatomic, weak) IBOutlet    UIView      *imgView;
@property (nonatomic, weak) IBOutlet    UIView      *cardView;
@property (nonatomic, weak) IBOutlet    UIView      *buttonsView;

@end

@implementation JXMeTabViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    _imgView.layer.cornerRadius = 35;
    _cardView.layer.cornerRadius = 5.f;
    _cardView.layer.masksToBounds = YES;
    
    self.navigationController.navigationBarHidden = YES;
    
    
    [self initRootView];
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [self.navigationController setNavigationBarHidden:YES animated:NO];
}

- (void)initRootView
{
    CGFloat width = SCREEN_WIDTH-20;
    
    _titleLabel = [[UILabel alloc] qmui_initWithFont:[UIFont systemFontOfSize:17] textColor:[UIColor whiteColor]];
    _titleLabel.text = @"公众互动";
    _titleLabel.textAlignment = NSTextAlignmentCenter;
    [self.view addSubview:_titleLabel];
    
    [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(self.view);
        make.height.mas_equalTo(44);
        make.top.mas_equalTo(self.view.mas_safeAreaLayoutGuideTop);
    }];
    
    QMUIButton *button = [[QMUIButton alloc] initWithFrame:CGRectMake(width/2-25, 10, 50, 80)];
    button.imagePosition = QMUIButtonImagePositionTop;
    [button setTitle:@"咨询留言" forState:UIControlStateNormal];
    [button setImage:[UIImage imageNamed:@"articleupload"] forState:UIControlStateNormal];
    button.titleLabel.font = [UIFont systemFontOfSize:11];
    [button setTitleColor:[UIColor qmui_colorWithHexString:@"#333333"] forState:UIControlStateNormal];
    [button addTarget:self action:@selector(zxClick) forControlEvents:UIControlEventTouchUpInside];
    [_buttonsView addSubview:button];
    
    QMUIButton *button1 = [[QMUIButton alloc] initWithFrame:CGRectMake(width/2-80, 10, 50, 80)];
    button1.imagePosition = QMUIButtonImagePositionTop;
    [button1 setTitle:@"地名新增" forState:UIControlStateNormal];
    [button1 setImage:[UIImage imageNamed:@"placedeclare"] forState:UIControlStateNormal];
    button1.titleLabel.font = [UIFont systemFontOfSize:11];
    [button1 setTitleColor:[UIColor qmui_colorWithHexString:@"#333333"] forState:UIControlStateNormal];
    [button1 addTarget:self action:@selector(addClick) forControlEvents:UIControlEventTouchUpInside];
    [_buttonsView addSubview:button1];
    
    QMUIButton *button2 = [[QMUIButton alloc] initWithFrame:CGRectMake(width/2-135, 10, 50, 80)];
    button2.imagePosition = QMUIButtonImagePositionTop;
    [button2 setTitle:@"作品上传" forState:UIControlStateNormal];
    [button2 setImage:[UIImage imageNamed:@"placeconsult"] forState:UIControlStateNormal];
    [button2 setTitleColor:[UIColor qmui_colorWithHexString:@"#333333"] forState:UIControlStateNormal];
    button2.titleLabel.font = [UIFont systemFontOfSize:11];
    [button2 addTarget:self action:@selector(uploadClick) forControlEvents:UIControlEventTouchUpInside];
    [_buttonsView addSubview:button2];
    
    QMUIButton *button3 = [[QMUIButton alloc] initWithFrame:CGRectMake(width/2+30, 10, 50, 80)];
    button3.imagePosition = QMUIButtonImagePositionTop;
    [button3 setTitle:@"地名统计" forState:UIControlStateNormal];
    [button3 setImage:[UIImage imageNamed:@"placeanalyse"] forState:UIControlStateNormal];
    [button3 setTitleColor:[UIColor qmui_colorWithHexString:@"#333333"] forState:UIControlStateNormal];
    button3.titleLabel.font = [UIFont systemFontOfSize:11];
    [button3 addTarget:self action:@selector(staticsClick) forControlEvents:UIControlEventTouchUpInside];
    [_buttonsView addSubview:button3];
    
    QMUIButton *button4 = [[QMUIButton alloc] initWithFrame:CGRectMake(width/2+85, 10, 50, 80)];
    button4.imagePosition = QMUIButtonImagePositionTop;
    [button4 setTitle:@"关于" forState:UIControlStateNormal];
    [button4 setImage:[UIImage imageNamed:@"userinfo"] forState:UIControlStateNormal];
    [button4 setTitleColor:[UIColor qmui_colorWithHexString:@"#333333"] forState:UIControlStateNormal];
    button4.titleLabel.font = [UIFont systemFontOfSize:11];
    [button4 addTarget:self action:@selector(aboutClick) forControlEvents:UIControlEventTouchUpInside];
    [_buttonsView addSubview:button4];
    
    button.spacingBetweenImageAndTitle = 5.f;
    button1.spacingBetweenImageAndTitle = 5.f;
    button2.spacingBetweenImageAndTitle = 5.f;
    button3.spacingBetweenImageAndTitle = 5.f;
    button4.spacingBetweenImageAndTitle = 5.f;
}

- (void)zxClick
{
    JXBaseWKWebViewController *vc = [[JXBaseWKWebViewController alloc] init];
    vc.webUrl = [NSURL URLWithString:@"http://www.wegis.net/demo/view/mobile/dist/index.html#/consultlist"];
    vc.webVCTitle = @"咨询留言";
    [self.tabBarController.navigationController pushViewController:vc animated:YES];
}

// 地名新增
- (void)addClick
{
    
}

// 作品上传
- (void)uploadClick
{
    
}

// 地名统计
- (void)staticsClick
{
    
}

// 关于
- (void)aboutClick
{
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
